package lecture09.teacher;

/*
* 构建实体类Teacher类,默认属性基本工资base=2000,私有属性name,salary,num
* 构建构造方法,输出总收入sumSalary()方法(base+salary)
* 在测试类创建对象(张三, 5000, 888)
* static关键字:
* 1.由static修饰的属性叫静态变量,其属性值是各对象所共享的
*
*
* */
class Teacher{
    static double base = 2000;
    private String name;
    private double salary;
    private String num;

    public Teacher() {
    }
    static {
        System.out.println("工资条:");
    }

    public Teacher(String name, double salary, String num) {
        this.name = name;
        this.salary = salary;
        this.num = num;
    }
    public double sumSalary() {
        return base+salary;
    }

    public void printInf() {
        System.out.println(name+"老师"+"工资"+sumSalary());
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public String getNum() {
        return num;
    }

    public void setNum(String num) {
        this.num = num;
    }

}


public class TeacherTest {
    static void main() {
        Teacher t1 = new Teacher("张三", 5000, "888");
        t1.printInf();
    }


}
